home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / After Dark / Twist 1.0b1 / GraphicsModule_Types.h < prev    next >
Text File  |  1995-06-24  |  4KB  |  141 lines

  1. /*
  2.     GraphicsModule_Types.h
  3.     
  4.     Data types and structures used by After Dark graphics modules.
  5.     
  6.     For more information, consult the programmer's section of the manual.
  7.      
  8.     By Patrick Beard, Bruce Burkhalter, Andrew Armstrong
  9.     
  10.     Copyright ©1989, 1990, 1991 Berkeley Systems, Inc.
  11. */
  12.  
  13. #ifndef __GRAPHICSMODULE_TYPES__
  14. #define __GRAPHICSMODULE_TYPES__
  15.  
  16. #ifndef __QUICKDRAW__
  17. #include <QuickDraw.h>
  18. #endif
  19.  
  20.  
  21. #ifndef __SOUND__
  22. #include <Sound.h>
  23. #endif
  24.  
  25. // This needs to be after the other includes in case they have a "#pragma options align=reset"
  26. #if PRAGMA_ALIGN_SUPPORTED
  27. #pragma push
  28. #pragma options align=mac68k
  29. #endif
  30.  
  31. /*
  32.     Messages that are passed to main() by After Dark:
  33.     
  34.     Initialize -        Allocate module's storage and get started.
  35.     Close -                Deallocate storage and shutdown.
  36.     Blank -                Blank out the screen (make it black).
  37.     DrawFrame -            Draw next frame of animation sequence.
  38.     ModuleSelected -    The module has specific processing to do when selected.
  39.     DoAbout -            Module can execute special code for an about message.
  40.     ButtonMessage -        Module wants to put up a dialog when a button is pressed.
  41.  */
  42.  
  43. typedef enum {
  44.     Initialize,
  45.     Close,
  46.     Blank,
  47.     DrawFrame,
  48.     ModuleSelected,
  49.     DoAbout,
  50.     ButtonMessage=8
  51. } GMMessage;
  52.  
  53. /* Return messages */
  54.  
  55. /*
  56.     The first three messages can be returned by DoInitialize(), DoClose(), DoBlank(), DoDrawFrame()
  57.     RefreshResources is valid only after a "SetUp" message.
  58.  */
  59.  
  60. enum {
  61.     ModuleError = -1,        /* After Dark will display the string params->errorMessage. */
  62.     RestartMe = 1,            /* After Dark will call main() with an "Initialize" message. */
  63.     ImDone,                    /* After Dark will not call main() again and take over drawing. */
  64.     RefreshResources        /* After Dark will redraw all controls after "SetUp" message. */
  65. };
  66.  
  67. /* bits in systemConfig that are special. */
  68.  
  69. #define MultiModuleRunning (1L << 10)        /* multimodule is present. */
  70. #define ModuleMayNotAnimate (1L << 9)        /* you may not animate. */
  71. #define SoundAvailable (1L << 15)            /* do we have sound? */
  72. #define ExtensionsAvailable (1L << 14)        /* are there extensions? */
  73.  
  74. /* types for looking at the monitors on the system. */
  75. struct MonitorData {
  76.     Rect    bounds;                            /* limiting rect of monitor (global coords) */
  77.     Boolean    synchFlag;                        /* flag set by monitor vbl task */
  78.     char    curDepth;                        /* current pixel depth */
  79. };
  80.  
  81. typedef struct MonitorData MonitorData, *MonitorDataPtr;
  82.  
  83. struct MonitorsInfo {
  84.     short        monitorCount;    /* number of monitors on system */
  85.     MonitorData    monitorList[1];    /* the monitors */
  86. };
  87.  
  88. typedef struct MonitorsInfo MonitorsInfo, *MonitorsInfoPtr;
  89.  
  90. /* copy of quickdraw globals */
  91. struct AD_QDGlobals {
  92.     GrafPtr        qdThePort;
  93.     Pattern        qdWhite;
  94.     Pattern        qdBlack;
  95.     Pattern        qdGray;
  96.     Pattern        qdLtGray;
  97.     Pattern        qdDkGray;
  98.     Cursor        qdArrow;
  99.     BitMap        qdScreenBits;
  100.     long        qdRandSeed;
  101. };
  102.  
  103. typedef struct AD_QDGlobals AD_QDGlobals, *AD_QDGlobalsPtr;
  104.  
  105. struct ExtensionElement {
  106.     OSType        selector;
  107.     Ptr            entryPoints;
  108. };
  109.  
  110. typedef struct ExtensionElement ExtensionElement;
  111.  
  112. struct ExtensionTable {
  113.     short                extensionCount;
  114.     ExtensionElement    extensionList[1];
  115. };
  116.  
  117. typedef struct ExtensionTable ExtensionTable, *ExtensionTablePtr;
  118.  
  119. /* the parameters passed in at every call to the graphics module */
  120. struct GMParamBlock {
  121.     short                controlValues[4];    /* the values of the user set sliders. */
  122.     MonitorsInfoPtr        monitors;            /* what monitors are connected and their depth. */
  123.     Boolean                colorQDAvail;        /* whether color is around. */
  124.     short                systemConfig;        /* bitmask of system configuration. */
  125.     AD_QDGlobalsPtr        qdGlobalsCopy;        /* read-only qd globals */
  126.     short                brightness;            /* message variable to tell NL to dim monitor */
  127.     Rect                demoRect;            /* rect of the Control Panel if in Demo Mode. */
  128.     StringPtr            errorMessage;        /* string to be displayed if error encountered. */
  129.     SndChannelPtr        sndChannel;            /* sound channel allocated for module's use. */
  130.     short                adVersion;            /* BCD After Dark version number. */
  131.     ExtensionTablePtr    extensions;            /* After Dark extensions table. */
  132. };
  133.  
  134. typedef struct GMParamBlock GMParamBlock, *GMParamBlockPtr;
  135.  
  136. #if PRAGMA_ALIGN_SUPPORTED
  137. #pragma pop
  138. #endif
  139.  
  140. #endif
  141.